<?php

namespace MoChat\App\Sales\Service;

use MoChat\App\Sales\Contract\WorkDepartmentContract;
use MoChat\App\Sales\Model\WorkDepartment;
use MoChat\Framework\Service\AbstractService;

class WorkDepartmentService extends AbstractService implements WorkDepartmentContract
{
    /**
     * @var WorkDepartment
     */
    protected $model;

    public function getSelect(): array
    {
        $list = $this->model->select([
            'id',
            'name'
        ])->get();
        return empty($list) ? [] : $list->toArray();
    }

    public function getOneWorkDepartmentById($id): array
    {
        return $this->model->getOneById($id, ['name']);
    }

    public function getAllWorkDepartmentById($ids)
    {
        return $this->model->getAllById($ids);
    }
}